﻿<UserControl x:Class="CAION2.Controls.StigmaToolTip"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:viewModels="clr-namespace:CAION2.ViewModels"
             xmlns:resources="clr-namespace:CAION2.Properties"
             xmlns:helpers="clr-namespace:CAION2.Helpers">

    <UserControl.DataContext>
        <viewModels:StigmaToolTipViewModel />
    </UserControl.DataContext>

    <UserControl.Resources>

        <viewModels:IconConverter x:Key="IconConverter"/>
        <viewModels:ItemTypeColorConverter x:Key="ItemTypeColorConverter"/>
        <viewModels:StigmaToolTipConverter x:Key="StigmaToolTipConverter"/>
        <viewModels:TextLenghtToVisibleConverter x:Key="TextLenghtToVisibleConverter"/>
        <helpers:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>

    </UserControl.Resources>
    
    <Grid>
        <TextBlock Text="{Binding Translate}"
                   Visibility="{Binding IsStigmaPlace, Converter={StaticResource BooleanToVisibilityConverter}, 
                                                       UpdateSourceTrigger=PropertyChanged,
                                                       Mode=OneWay}"/>
        <Grid Visibility="{Binding IsStigmaPlace, Converter={StaticResource BooleanToVisibilityConverter},
                                                  ConverterParameter=inverse,
                                                  UpdateSourceTrigger=PropertyChanged,
                                                  Mode=OneWay}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="45"/>
                <ColumnDefinition MaxWidth="405"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="50"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <Image Source="{Binding CurrentStigmaRow[skillicon_name], Converter={StaticResource IconConverter}}"
                   Width="40"
                   Height="40"
                   VerticalAlignment="Top"
                   Stretch="Uniform"
                   Margin="0,0,5,0"/>

            <TextBlock Grid.Row="0" 
                       Grid.Column="1"
                       Text="{Binding CurrentStigmaRow[translate]}"
                       Foreground="{Binding CurrentStigmaRow[quality], Converter={StaticResource ItemTypeColorConverter}}"
                       TextWrapping="Wrap"
                       VerticalAlignment="Top"/>

            <TextBlock Grid.Row="0" 
                       Grid.Column="1"
                       FontSize="10"
                       Margin="0,0,0,10"
                       Text="{Binding CurrentStigmaRow[level], Converter={StaticResource StigmaToolTipConverter}, ConverterParameter=Level}"
                       TextWrapping="Wrap"
                       VerticalAlignment="Bottom"/>

            
            <TextBlock Grid.Row="1"
                       Grid.Column="1"
                       FontSize="11"
                       Foreground="{DynamicResource ItemTextDisabled}"
                       Text="{x:Static resources:Resources.Stigma_Stage1}"
                       Visibility="{Binding ChainVisible}"
                       Margin="0,5,0,0"
                       VerticalAlignment="Center"/>

            <Border Grid.Row="2"
                    Grid.Column="1"
                    BorderThickness="0,1"
                    BorderBrush="{DynamicResource ButtonTextDisabled}">
                
                <TextBlock Text="{Binding CurrentStigmaRow[desc_long]}"
                           TextWrapping="Wrap"
                           Margin="0,2"
                           MaxWidth="400"
                           VerticalAlignment="Center"/>
                
            </Border>
            
            <TextBlock Grid.Row="3"
                       Grid.Column="1"
                       FontSize="11"
                       Margin="0,5"
                       TextWrapping="Wrap"
                       VerticalAlignment="Center"
                       Text="{Binding CurrentStigmaRow.ItemArray, Converter={StaticResource StigmaToolTipConverter}, 
                                                                  ConverterParameter=Enhanted}"/>


            <StackPanel Grid.Row="4"
                        Grid.Column="1"
                        Visibility="{Binding ChainVisible}"
                        Orientation="Vertical">

                <TextBlock FontSize="11"
                           Foreground="{DynamicResource ItemTextDisabled}"
                           Text="{x:Static resources:Resources.Stigma_Stage2}"
                           Margin="0,5,0,0"
                           VerticalAlignment="Center"/>

                <Border BorderThickness="0,1"
                        BorderBrush="{DynamicResource ButtonTextDisabled}">
                    <TextBlock Text="{Binding Stigma2Row[desc_long]}"
                           TextWrapping="Wrap"
                           MaxWidth="400"
                           Margin="0,0,5,0"
                           VerticalAlignment="Center"/>
                </Border>

                <TextBlock Margin="0,5,0,0"
                           TextWrapping="Wrap"
                           FontSize="11"
                           VerticalAlignment="Center"
                           Text="{Binding Stigma2Row.ItemArray, Converter={StaticResource StigmaToolTipConverter}, 
                                                                ConverterParameter=Enhanted}"/>

                <TextBlock FontSize="11"
                           Foreground="{DynamicResource ItemTextDisabled}"
                           Text="{x:Static resources:Resources.Stigma_Stage3}"
                           Margin="0,10,0,0"
                           VerticalAlignment="Center"/>

                <Border BorderThickness="0,1"
                        BorderBrush="{DynamicResource ButtonTextDisabled}">
                    <TextBlock Text="{Binding Stigma3Row[desc_long]}"
                           TextWrapping="Wrap"
                           MaxWidth="400"
                           Margin="0,0,5,0"
                           VerticalAlignment="Center"/>
                </Border>
                
                <TextBlock Margin="0,5,0,0"
                           TextWrapping="Wrap"
                           FontSize="11"
                           VerticalAlignment="Center"
                           Text="{Binding Stigma3Row.ItemArray, Converter={StaticResource StigmaToolTipConverter}, 
                                                                ConverterParameter=Enhanted}"/>

            </StackPanel>

            <StackPanel Grid.Column="1"
                        Grid.Row="5"
                        Margin="0,10,0,0"
                        Orientation="Horizontal">

                <Image Source="/CAION2;component/UI2/CrystalShard.png"
                            Width="16"
                            Height="16"
                            VerticalAlignment="Center"
                            Margin="0,0,5,0"/>

                <TextBlock Text="{Binding CurrentStigmaRow[require_shard], StringFormat={}{0:N0}}"
                                TextWrapping="Wrap"
                                VerticalAlignment="Center"/>

                <Image Source="/CAION2;component/UI2/AbyssPoints.png"
                            Width="16"
                            Height="16"
                            Visibility="{Binding CurrentStigmaRow[abyss_point], Converter={StaticResource TextLenghtToVisibleConverter},
                                                        FallbackValue=Visibility.Collapsed}"
                            VerticalAlignment="Center"
                            Margin="20,0,5,0"/>

                <TextBlock Text="{Binding CurrentStigmaRow[abyss_point], StringFormat={}{0:N0}, ConverterCulture=Ru-ru}"
                                TextWrapping="Wrap"
                                VerticalAlignment="Center"/>

            </StackPanel>

        </Grid>
    </Grid>
</UserControl>
